package com.celebriosoftware.client;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.webkit.WebView;

public class CelebrioWebView extends WebView {

	public CelebrioWebView(Context context) {
		super(context);
	}
	
	public CelebrioWebView(Context context, AttributeSet attrs) {
		super(context, attrs);
	}
	
	public CelebrioWebView(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
	}
	
	private long lastMoveEventTime = -1;
    private int eventTimeInterval = 25;

    @Override
    public boolean onTouchEvent(MotionEvent ev) {

        long eventTime = ev.getEventTime();
        int action = ev.getAction();

        switch (action){
            case MotionEvent.ACTION_MOVE: {
            	//System.out.println("Je tu MOVE");
                if ((eventTime - lastMoveEventTime) > eventTimeInterval){
                    lastMoveEventTime = eventTime;
                    //System.out.println("MOVE pustenej");
                    return super.onTouchEvent(ev);
                }
                break;
            }
            case MotionEvent.ACTION_DOWN:
            case MotionEvent.ACTION_UP: {
                return super.onTouchEvent(ev);
            }
        }
        return true;
    }

}
